﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 文档打印
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            int index = 0;

            for(index=0;index<10;index++)
            {
                index = dataGridView1.Rows.Add();
                dataGridView1.Rows[index].Cells["col_id"].Value = (index+1).ToString();
                dataGridView1.Rows[index].Cells["col_name"].Value = "name" + (index+1).ToString();
                dataGridView1.Rows[index].Cells["col_money"].Value = ((index+1) * 10).ToString() + "元";
                dataGridView1.Rows[index].Cells["col_time"].Value = DateTime.Now.AddDays(index);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            ToPrint tp = new ToPrint();

            tp.PrintPriview(tp.GetTable(dataGridView1), "打印测试");
            
        }

        
    }
}
